# Maintainer : Sven-Hendrik Haase <svenstaro@archlinux.org>
pkgname=openvdb
pkgver=11.0.0
pkgrel=1
pkgdesc='A large suite of tools for the efficient storage and manipulation of sparse volumetric data discretized on three-dimensional grids'
url='https://github.com/dreamworksanimation/openvdb'
arch=('loong64' 'x86_64')
license=('MPL')
depends=('boost-libs' 'intel-tbb' 'zlib' 'jemalloc' 'blosc' 'log4cplus')
makedepends=('doxygen' 'boost' 'cmake' 'mesa' 'cppunit' 'glfw-x11' 'glu' 'python'
             'python-numpy' 'ninja' 'pybind11')
optdepends=('glfw: for tools'
            'glu: for tools'
            'python-numpy: python module')
source=("$pkgname-$pkgver.tar.gz::https://github.com/AcademySoftwareFoundation/openvdb/archive/v${pkgver}.tar.gz")
sha512sums=('f2c90ca8435ecbacefda429341000ecb555385c746a3e0233220cd78540cee2a26cc17df7b560fdfe2dc03f2b2e960a2fa226a85980189c3e018164ccc037bd4')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  cmake \
    -Bbuild \
    -GNinja \
    -DUSE_NUMPY=ON \
    -DUSE_LOG4CPLUS=ON \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DOPENVDB_BUILD_PYTHON_MODULE=ON \
    -DOPENVDB_BUILD_DOCS=ON \
    -DOPENVDB_BUILD_UNITTESTS=OFF

  ninja -C build
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}/build"

  DESTDIR="${pkgdir}" ninja install
  # Try to workaround FS#72653 for now
  mkdir -p "${pkgdir}"/usr/share/cmake/Modules/
  ln -s /usr/lib/cmake/OpenVDB/{OpenVDBUtils,FindOpenVDB,FindBlosc}.cmake "${pkgdir}"/usr/share/cmake/Modules/
}

# vim:set sw=2 sts=2 et:
